package com.hkfn.rfb.rfb.bean;

import com.hkfn.rfb.common.bean.BaseModel;
import com.hkfn.rfb.common.bean.ConstData;

import java.text.SimpleDateFormat;
import java.util.Date;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * Rfb工单对象
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class RfbSystemOperationModel extends BaseModel {

    private long _id;

    /**
     * 工单类型 0充放电故障 1消防故障 2加热故障
     */
    private String orderType;

    private long startTime;

    private long stopTime;

    /**
     * 发起人 0本机
     */
    private String startPerson;

    private String deviceInfo;

    private String alarmStatus;

    private String orderStatus;

    private String orderDescription;

    private long completeTime;

    private String key;

    /**
     * 获取工单类型
     * @return
     */
    public String obtainTypeStr(){
        switch (orderType){
            case "0":
                return "充放电故障";
            case "1":
                return "消防故障";
            default:
                return "加热故障";
        }
    }

    /**
     * 获取发起时间
     * @return
     */
    public String obtainStartTimeStr(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ConstData.TIME_FORMAT_YYYY_MM_DD);
        return simpleDateFormat.format(new Date(startTime));
    }

    /**
     * 获取结束时间
     * @return
     */
    public String obtainStopTimeStr(){
        if (0 != stopTime) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ConstData.TIME_FORMAT_YYYY_MM_DD);
            return simpleDateFormat.format(new Date(stopTime));
        }
        return "-";
    }


    /**
     * 获取状态
     * @return
     */
    public String obtainAlarmStatusStr(){
        switch (orderStatus){
            case "0":
                return "未结束";
            default:
                return "已结束";
        }
    }


    /**
     * 获取状态
     * @return
     */
    public String obtainOrderStatusStr(){
        switch (orderStatus){
            case "0":
                return "未完成";
            default:
                return "已完成";
        }
    }

    /**
     * 获取完成时间
     * @return
     */
    public String obtainCompleteTimeStr(){
        if (0 != completeTime) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ConstData.TIME_FORMAT_YYYY_MM_DD);
            return simpleDateFormat.format(new Date(completeTime));
        }
        return "-";
    }

    public String getStartPersonStr(){
        return "本机";
    }



}
